home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.rexx
- Path: dd.chalmers.se!news.chalmers.se!sunic!pipex!howland.reston.ans.net!cs.utexas.edu!asuvax!ennews!mcdphx!schbbs!waccvm.corp.mot.com!ACUS02
- From: ACUS02@waccvm.corp.mot.com (David McAnally)
- Subject: Re: Parsing Data
- Organization: Motorola
- Date: Wed, 26 Jan 94 20:01:36 MST
- Message-ID: <16F4A119A9S86.ACUS02@waccvm.corp.mot.com>
- References: <2i6es7$vt@delphinium.cig.mot.com>
- Sender: news@schbbs.mot.com (Net News)
- Nntp-Posting-Host: waccvm.corp.mot.com
- Lines: 41
-
- In article <2i6es7$vt@delphinium.cig.mot.com>
- bachww@ferret.cig.mot.com (Bud Bach) writes:
-
- >
- >Hi, I need to parse some data. The data looks like:
- >
- > 'f1|f2|f3|f4...'
- >
- >where fn is field data. My first cut at it was:
- >
- > d = 'pp|t|123|John Smith|555-1212'
- > parse var d with f1 '|' f2 '|' f3 '|' f4
- > say f1 '*' f2 '*' f3 '*' f4
- >
- >The result was:
- >
- > * pp * t * 123 * John Smith|555-1212
- >
- >The problem is that it seems to drop the first field.
- >
- >Am I doing something wrong?
- >
- >Is there a better way tgo do this?
- >
- >This is under os/2 2.1 -- Bud
- >
-
- Just change the parse line to either ...
-
- parse value d with f1 '|' f2 '|' f3 '|' f4
-
- or...
-
- parse var d f1 '|' f2 '|' f3 '|' f4
-
-
- Regards,
- David McAnally
- CSS Applications Engineering
- Motorola
-